<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>Insert title here</title>
	</head>

	<e:View id="view">
	    <script type="text/javascript" src="<c:url value='/scripts/global.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/scripts/skin.js'/>"></script>
	    <script type="text/javascript">SkinUtil.getSkin();</script>
	    <script type="text/javascript">SkinUtil.getModuleSkin();</script>
    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_Team" datasetDefinition="DatasetDefinition_zb.dsd" datasetRef="Dataset_Team" pageSize="10" loadDataCommand="Command_Load">
				<e:Field name="teamId" dataType="string" label="分组ID" maxLength="32" visible="false"/>
				 <e:Field name="teamName" dataType="string" label="分组名称" maxLength="100" required="true"/>
				 <e:Field name="sortNo" dataType="long" label="排序号" maxLength="22" required="true"/>
				 <e:Field name="remark" dataType="string" label="备注" maxLength="400" />
				 <e:Field name="createTime" dataType="date" label="创建时间" maxLength="7" readOnly="true"/>
				 <e:Field name="createUserId" dataType="string" label="创建人ID" maxLength="32" visible="false"/>
				 <e:Field name="createUserName" dataType="string" label="创建人名称" maxLength="100" readOnly="true"/>
				 <e:Field name="createOrgId" dataType="string" label="创建机构ID" maxLength="32" visible="false"/>
				 <e:Field name="createOrgName" dataType="string" label="创建机构名称" maxLength="100" readOnly="true"/>
				 <e:Field name="orgLevelCode" dataType="string" label="机构级次" maxLength="100" readOnly="true"/>
				 <e:Field name="updateUserId" dataType="string" label="修改人ID" maxLength="32" readOnly="true"/>
				 <e:Field name="updateUserName" dataType="string" label="修改人" maxLength="100" readOnly="true"/>
				 <e:Field name="updateTime" dataType="date" label="修改时间" maxLength="7" readOnly="true"/>
			</e:Dataset>
			
			<e:Command id="Command_Save" action="com.longtop.perform.zb.team.web.TeamListAction" method="saveTeam" submitForm="true" validateRequired="true" onExecuteSuccess="Button_Search_onClick()">
				<e:DatasetInfo name="DatasetInfo1" dataset="Dataset_Team" alwayRefreshClient="false" submitType="changes"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Search" action="com.longtop.perform.zb.team.web.TeamListAction" method="searchTeam" submitForm="true" submitFormScope="all" validateRequired="true">
				<e:DatasetInfo name="DatasetInfo2" dataset="Dataset_Team" alwayRefreshClient="true" submitType="all"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Load" action="com.longtop.perform.zb.team.web.TeamListAction" method="loadTeam" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo3" dataset="Dataset_Team" alwayRefreshClient="true"></e:DatasetInfo>
			</e:Command>
			
		</div>

		<body>
			<e:Page id="ePage" action="com.longtop.perform.zb.team.web.TeamListAction" style="min-height: 80px; width: 100%; height: 100%;" onAfterLoadPage="ePage_onAfterLoadPage()">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td valign="top" width="100%">
							<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
								<tr>
									<td>
										<e:GroupBox id="GroupBox1" caption="查询条件" style="height: 100%; width:100%;">
											<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
												<tr>
													<td align="right" nowrap="nowrap">
														<e:Label id="Label_teamName" caption="分组名称"></e:Label>
													</td>
													<td align="left">
														<e:Text id="Text_teamName" style="width:100px;"></e:Text>
													</td>
													<td align="left" width="99%">
														<e:Button id="Button_Search" style='height: 22px; width: 70px' caption="查询" command="Command_Search" icon="/images/query.gif" onClick="Button_Search_onClick()"></e:Button>
													</td>
												</tr>
											</table>
										</e:GroupBox>
									</td>
								</tr>	
								<tr>
									<td>
										<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
											<tr>
												<td height="27px" width="1%">
													<e:RecordNavigator id="RecordNavigator_Team" dataset="Dataset_Team" showNavigatorButton="false">
														<e:RecordButton id="RecordButton_insert" label="新增" onClick="insertRecord" icon="/images/add.gif"></e:RecordButton>
														<e:RecordButton id="RecordButton_delete" label="删除" onClick="deleteRecord" icon="/images/delete.gif"></e:RecordButton>
														<e:RecordButton id="RecordButton_save" label="保存" icon="/images/submit.gif" onClick="RecordButton_save_onClick()"></e:RecordButton>
														<e:RecordButton id="RecordButton_ralation" label="关联指标" icon="/images/edit.gif" onClick="RecordButton_ralation_onClick()"></e:RecordButton>
													</e:RecordNavigator>
												</td>
												<td align="left" width="99%"><e:PageNavigator id="PageNavigator_Team" dataset="Dataset_Team" showRecordNum="true"></e:PageNavigator></td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td>
										<e:Grid id="Grid_Team" style="width: 100%; height: 100%;" showIndex="true" dataset="Dataset_Team" onClick="Grid__Team_onClick()">
										</e:Grid>
									</td>
								</tr>
							</table>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
	</e:View>
</html>	

<script type="text/javascript">
	//init
	function ePage_onAfterLoadPage(){
	}
	
	//查询
	function Button_Search_onClick(){
	    Command_Search.execute();
	}
	
	//保存
	function RecordButton_save_onClick(){
	    Command_Save.execute();
	}
		
	//单击记录,确定主键是否可编辑
	function Grid__Team_onClick(){
		var element = event.srcElement;
		if(element.isDataCell){
			if(element.isDataCell){
		        var currentRecord = element.record;
		        if(currentRecord.state == Constant.RECORD.STATE_NEW || currentRecord.state == Constant.RECORD.STATE_INSERT) {
	          		currentRecord.dataset.getField("teamName").setReadOnly(false);
	          	} else{
			        currentRecord.dataset.getField("teamName").setReadOnly(true);
	       		}
			}
		}
	}
	
	//关联指标
	function RecordButton_ralation_onClick(){
		var record = Dataset_Team.getCurrentRecord();
		if(record){
			var id = record.getValue("teamId");
			if(id != null && id != ''){
				var path = "/jsp/perform/zb/team/teamIndex.jsp?teamId="+id+"&doflag="+"edit";
				parent.TabUtil.openTab("systemTeam","关联指标",path,true);
			}
		}
	}	
	
	//操作成功
	function Command_Operate_onExecuteSuccess(command){
		alert("操作成功！");
		Command_Load.execute();
	}	
</script>